import {  GET_ADMINS_ID ,CHANGE_ADMINS} from '../types';
import { handleActions } from 'redux-actions';
import _ from 'lodash';

const Initdata = {
    _id:'',
    adminName:'',
    adminPassword:'',
    phone:0,
}

export const oneAdmins = handleActions({
    // 获取对应_id数据
    [GET_ADMINS_ID]: (state, { payload }) => {

        const { adminName, adminPassword,phone , _id } = payload.data;
        return _.assign({}, state, {
            adminName, adminPassword,phone , _id
        })
    },
    
    // 修改
    [CHANGE_ADMINS]: (state, { payload }) => {
        // 
        const {adminName, adminPassword,phone , _id } = payload.data;
        console.log(adminName, adminPassword,phone, _id);
        return _.assign({}, state, {
            adminName, adminPassword,phone, _id
        })
    },



}, Initdata)